using System;

namespace JanusLibAing.EventsArg
{
    /// <summary>
    /// Event argument with exception
    /// Normally this exception produced error event
    /// Exception could be null for inherited classes
    /// </summary>
    public class ExceptionEventArgs : DescriptionEnumEventArgs
    {
        private readonly System.Exception exception = null;

        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionEventArgs"/> class.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="id">The id.</param>
        public ExceptionEventArgs(System.Exception exception, Enum id)
            : base(id, "")
        {
            this.exception = exception;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionEventArgs"/> class.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="id">The id.</param>
        /// <param name="description">The description.</param>
        public ExceptionEventArgs(System.Exception exception, Enum id, string description)
            : base(id, description)
        {
            this.exception = exception;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionEventArgs"/> class.
        /// </summary>
        /// <param name="exception">The exception.</param>
        public ExceptionEventArgs(System.Exception exception)
            : base(default(Enum), "")
        {
            this.exception = exception;
        }

        /// <summary>
        /// Exception from which this event was generated
        /// </summary>
        public System.Exception ExceptionReason
        {
            get
            {
                return exception;
            }
        }
    }
}